<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" href="../../static/mobile/default/css/layout.css?v=2" />
    <link rel="icon" type="image/png" href="../../static/favicon.ico" />
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
    <script src="../../static/js/jquery/jquery/2.1.4/jquery.min.js"></script>
    <script src="../../static/js/jquery/jquery.cookie.js"></script>
    <script src="../../static/mobile/default/js/page.js?v=1"></script>
    <title>个人资料 - 达漂亮</title>

    <link rel="stylesheet" href="../../static/mobile/default/css/picker.css" />
    <link rel="stylesheet" href="../../static/mobile/default/css/userData.css" />


</head>

<body personalData>
    <div class="page ">
        <div class="page-hd">
            <div class="header base-header bor-1px-b">
                <div class="header-left">
                    <a href="javascript:history.go(-1)" class="left-arrow"></a>
                </div>
                <div class="header-title">个人资料</div>
                <div class="header-right">
                    <!-- <a href=""></a> -->
                </div>
            </div>
        </div>

        <div class="page-bd ">
            <form id="userform">
                <!-- 页面内容-->
                <div class="cells">
                    <a class="top cell  noline">
                        <div class="cell_bd">
                            <span class="fs34 color_3 fw_b">个人头像</span></div>
                        <div class="cell_ft" style="width: 0.8rem;height: 0.533333rem;">
                            <img src="../../static/mobile/default/images/defheadimg.jpg" alt="" class="userimg" style="position: absolute;">
                            <!--<input type="file" class="uploadInput" style="width:100%;height:100%;opacity:0;">-->
                        </div>
                    </a>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28 color_9  ">昵称</span></div>
                        <div class="cell_ft">
                            <span class="fs28 color_3 fw_b nick_name"></span>
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd"><span class="fs28 color_9">ID</span></div>
                        <div class="cell_ft">
                            <p class="fs28 color_3 fw_b userId"></p>
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28  color_9">注册时间</span></div>
                        <div class="cell_ft">
                            <p class="fs28 color_3 fw_b register_time"></p>
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28  color_9">真实姓名</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="realName" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28  color_9">身份证号码</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="idCard" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28  color_9">银行卡号码</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="bankCard" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
                        </div>
                    </div>
                    <!--<div class="cell">-->
                    <!--    <div class="cell_bd">-->
                    <!--  <span class="fs28  color_9">生日</span></div>-->
                    <!--  <div class="cell_ft">-->
                    <!--      <input type="text" value="0000-00-00"  name="birthday"  readonly class="fs28 color_3 fw_b" id="nowValue" placeholder="请选择">-->
                    <!--  </div>-->
                    <!--</div>-->
                    <a href="./address.html" class="cell twoBox cell_access">
                        <div class="cell_bd">
                            <span class="fs28 color_9">收货地址管理</span></div>
                        <div class="cell_ft">
                        </div>
                    </a>
                    <a class="phoneNumber cell_access" href="../../user/user/bindphone.html">
                        <div class="cell">
                            <div class="cell_bd">
                                <span class="fs28 color_9">绑定手机号</span></div>
                            <div class="cell_ft">
                                <p class="fs28 color_3 fw_b  phone"></p>
                            </div>
                        </div>
                    </a>
                     <div class="cell">
                        <div class="cell_bd">
                      <span class="fs28 color_9">所在行业</span></div>
                      <div class="cell_ft">
                          <input type="text" value="" name="keywords" class="fs28 color_3 fw_b inputbox" placeholder="请输入,格式如：大健康,金融,软件">
                      </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28 color_9">公司名称</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="compName" class="fs28 color_3 fw_b inputbox">
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28 color_9">职务</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="position" class="fs28 color_3 fw_b inputbox">
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28 color_9">公司地址</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="compAddr" class="fs28 color_3 fw_b inputbox">
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28 color_9">行业优势</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="indAdvance" class="fs28 color_3 fw_b inputbox">
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28 color_9">可提供资源</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="supplyRes" class="fs28 color_3 fw_b inputbox">
                        </div>
                    </div>
                    <div class="cell">
                        <div class="cell_bd">
                            <span class="fs28 color_9">需要引荐资源</span></div>
                        <div class="cell_ft">
                            <input type="text" value="" name="needRes" class="fs28 color_3 fw_b inputbox">
                        </div>
                    </div>
                    <!--<div class="cell">
              <div class="cell_bd">
              <span class="fs28 color_9">是否公开手机号</span></div>
              <div class="cell_ft">
                  <input type="checkbox" name="show_mobile" value="1" id="male" class="chooseBtn" />
                  <label for="male" class="choose-label"></label>
              </div>
            </div>-->
                    <a href="../logout.html" class=" cell cell_access noline">
                        <div class="cell_bd"><span class="fs28 color_3 fw_b">退出登录</span></div>
                    </a>
                </div>

            </form>

            <div class="page-ft">
                <span class="fs32 color_w fw_b BGcolor_r postBtn">保存</span>
            </div>

        </div>


    </div>

    <script src="../../static/js/art-template.js"></script>
    <script src="../../static/mobile/default/js/lib/fastclick.js"></script>
    <script src="../../static/js/jquery/lazyload/jquery.lazyload.js"></script>
    <script>
        $(function() {
            FastClick.attach(document.body);
            $("img.lazy").lazyload({
                effect: "fadeIn",
                event: "scroll",
                container: $(".page-bd")
            });
        });
    </script>

    <script src="../../static/mobile/default/js/datePicker.js"></script>
    <script src="../../static/mobile/default/js/picker.min.js"></script>
    <script>
        //获取用户信息
        function getUserInfo() {
            $.ajax({
                url: 'https://mp.jianguoes.com/api/mp/getUserInfo', // 跳转到 action
                data: {},
                type: 'get',
                headers: {
                    token: $.cookie('code')
                },
                dataType: 'json',
                success: function(res) {
                    console.log(res);
                    if (res.errno == 0) {
                        $('.nick_name').text(res.data.nickname)
                        $('.userId').text(5000000 + Number(res.data.userId))
                        $('.register_time').text(res.data.register_time)
                        $('.userimg').attr("src", res.data.avatar)

                        if (res.data.mobile) {
                            $('.phone').text(res.data.mobile)
                            // $('.phoneNumber').removeClass('cell_access')
                        } else {
                            $('.phoneNumber').attr('href', '../../user/user/bindphone.html')
                            // $('.phoneNumber').addClass('cell_access')
                        }

                        $('input[name=realName]').val(res.data.realName)
                        $('input[name=idCard]').val(res.data.idCard)
                        $('input[name=bankCard]').val(res.data.bankCard)
                        $('input[name=keywords]').val(res.data.keywords)

                        $('input[name=compName]').val(res.data.compName)
                        $('input[name=position]').val(res.data.position)
                        $('input[name=compAddr]').val(res.data.compAddr)
                        $('input[name=indAdvance]').val(res.data.indAdvance)
                        $('input[name=supplyRes]').val(res.data.supplyRes)
                        $('input[name=needRes]').val(res.data.needRes)

                        if (res.data.user_level_id == 1) {
                            $('.level').text('游客')
                        } else if (res.data.user_level_id == 2) {
                            $('.level').text('VIP')
                        } else if (res.data.user_level_id == 3) {
                            $('.level').text('合伙人')
                        } else if (res.data.user_level_id == 4) {
                            $('.level').text('大区合伙人')
                        } else if (res.data.user_level_id == 5) {
                            $('.level').text('联合创始人')
                        } else if (res.data.user_level_id == 6) {
                            $('.level').text('战略合作商')
                        }else if (res.data.user_level_id == 7) {
                            $('.level').text('总公司')
                        }

                    }

                },
                error: function() {

                }
            });
        }
    </script>
    <script>
        share()

        function share() {
            /***用户点击分享到微信圈后加载接口接口*******/
            var url = window.location.href;
            console.log("url:" + url);
            $.ajax({
                url: "/api/mp/wxconfig",
                type: "post",
                data: {
                    shareUrl: url
                },
                headers: {
                    token: $.cookie('code')
                },
                dataType: "json",
                success: function(data) {
                    configData = {
                        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                        appId: data.data.appid, // 必填，公众号的唯一标识
                        timestamp: data.data.timestamp, // 必填，生成签名的时间戳
                        nonceStr: data.data.nonceStr, // 必填，生成签名的随机串
                        signature: data.data.signature, // 必填，签名，见附录1
                        jsApiList: ['hideOptionMenu']
                            // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                    };

                    //step2:注入配置信息
                    wx.config(configData);
                    //step3:通过ready接口处理成功验证
                    wx.ready(function() {
                        // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
                        //                 alert("执行ready方法");
                        //                 wx.checkJsApi({
                        //                      jsApiList: ['chooseImage'] // 需要检测的JS接口列表，所有JS接口列表见附录2,
                        //                      success: function(res) {
                        //                      // 以键值对的形式返回，可用的api值true，不可用为false
                        //                      // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
                        //                      }
                        //                 });
                        //接口1:获取网络类型
                        wx.getNetworkType({
                            success: function(res) {
                                oldNet = res.networkType; // 返回网络类型2g，3g，4g，wifi
                                //                        alert("网络类型"+ oldNet);
                            }
                        });
                        //禁用右上角菜单按钮
                        wx.hideOptionMenu();
                    })
                },
                error: function() {
                    // 			    _alert('ajax request failed!!!!');
                    return;
                }
            })



        }
        $(function() {

                getUserInfo()

                $('#nowValue').on('click', function() {
                    demoClick()
                })
                $('.inputbox').on('click', function() {
                    $(this).val('')
                })
                $('.picker-mask').on('click', function() {
                    $('.picker').hide();
                })
            })
            // 日期选择器
        function demoClick() {
            var nowValue = document.getElementById('nowValue');
            new DatePicker({
                "type": "3", //0年, 1年月, 2月日, 3年月日
                "title": '请选择日期', //标题(可选)
                "maxYear": "", //最大年份（可选）
                "minYear": "", //最小年份（可选）
                "separator": ".", //分割符(可选)
                "defaultValue": nowValue.value, //默认值（可选）
                "callBack": function(val) {
                    //回调函数（val为选中的日期）
                    nowValue.value = val;
                }
            });
        }
        //   //性别选择
        //   var obj=document.getElementById('sex')
        //   var data1 = [
        //       {
        //         text:'男',
        //         value: '1',
        //       }, {
        //         text:'女',
        //         value: '2',
        //       }
        //   ];
        //   //初始化picker
        //   var picker = new Picker({
        //       data: [data1],
        //       selectedIndex: [0],
        //       title: '请选择性别'
        //   });
        //   //选择后的内容赋值
        //   picker.on('picker.select', function (selectedVal, selectedIndex) {
        //     obj.value = data1[selectedIndex].text;
        //   })
        //   //点击弹出选项框
        //   obj.addEventListener('click', function () {
        //       picker.show();
        //   });

        var fd = new FormData();

        $('.postBtn').click(function() {
            // 	var data = $('#userform').toJson();
            // 	$.each(data,function(i,v){
            // 		fd.append(i, v);	
            // 	})

            if ($('input[name=realName]').val() == '') {
                return _alert('请输入真实姓名')
            } else if ($('input[name=idCard]').val() == '') {
                return _alert('请输入身份证号码')
            } else if ($('input[name=bankCard]').val() == '') {
                return _alert('请输入银行卡号码')
            }
            $.ajax({
                url: '/api/mp/updateUserInfo',
                type: 'get',
                headers: {
                    token: $.cookie('code')
                },
                data: {
                    realName: $('input[name=realName]').val(),
                    idCard: $('input[name=idCard]').val(),
                    bankCard: $('input[name=bankCard]').val(),
                    keywords: $('input[name=keywords]').val(),
                    compName: $('input[name=compName]').val(),
                    position: $('input[name=position]').val(),
                    compAddr: $('input[name=compAddr]').val(),
                    indAdvance: $('input[name=indAdvance]').val(),
                    supplyRes: $('input[name=supplyRes]').val(),
                    needRes: $('input[name=needRes]').val()
                },
                success: function(res) {

                    if (res.errno == 0) {
                        _alert(res.data);
                        return;
                    }
                }
            })
        })
    </script>
    <script src="../../static/mobile/default/js/uploadsimage.js?v=1"></script>
    <script>
        //处理点击改变的调用函数-做IOS兼容
        $(_listenSelector).click(function() {
            var that = $(this);
            _uplocalfunction = function(base64Img) {
                    fd.append("imgfile", base64Img);
                    $('.userimg').attr('src', base64Img);
                }
                //console.log(typeof(_uplocalfunction))
        })
    </script>

    <div class="alertBox">
        <div class="alertBG"></div>
        <div class="alert">
            <div class="text fs30 color_3 bor_b">

            </div>
            <!-- 单按钮 -->
            <div class="button fs32 fw_b color_r">
                知道了
            </div>
            <!-- 双按钮 -->
            <div class="buttonBox fs32 fw_b">
                <span class="color_9 bor_r cancel">取消</span>
                <span class="color_r confirm">确定</span>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        var is_xcx = 0;
        $(document).on('click', 'a', function() {
            var href = $(this).attr('href');
            if (href.indexOf('/pages') != -1) {
                if (is_xcx == 1) {
                    wx.miniProgram.navigateTo({
                        url: href
                    })
                    return false;
                } else {
                    return false;
                }
            }
        })
    </script>
</body>

</html>